using module mode; GOMOD=/home/client/go/src/github.com/linchao/zkp-authentication/go.mod
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#375EAB">

  <title>server - Go Documentation Server</title>

<link type="text/css" rel="stylesheet" href="/lib/godoc/style.css">

<script>window.initFuncs = [];</script>
<script src="/lib/godoc/jquery.js" defer></script>



<script>var goVersion = "go1.20.4";</script>
<script src="/lib/godoc/godocs.js" defer></script>
</head>
<body>

<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
...
</div><!-- #lowframe -->

<div id="topbar" class="wide"><div class="container">
<div class="top-heading" id="heading-wide"><a href="/pkg/">Go Documentation Server</a></div>
<div class="top-heading" id="heading-narrow"><a href="/pkg/">GoDoc</a></div>
<a href="#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a>
<form method="GET" action="/search">
<div id="menu">

<span class="search-box"><input type="search" id="search" name="q" placeholder="Search" aria-label="Search" required><button type="submit"><span><!-- magnifying glass: --><svg width="24" height="24" viewBox="0 0 24 24"><title>submit search</title><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/><path d="M0 0h24v24H0z" fill="none"/></svg></span></button></span>
</div>
</form>

</div></div>



<div id="page" class="wide">
<div class="container">


  <h1>
    Package server
    <span class="text-muted"></span>
  </h1>







<div id="nav"></div>


<!--
	Copyright 2009 The Go Authors. All rights reserved.
	Use of this source code is governed by a BSD-style
	license that can be found in the LICENSE file.
-->
<!--
	Note: Static (i.e., not template-generated) href and id
	attributes start with "pkg-" to make it impossible for
	them to conflict with generated attributes (some of which
	correspond to Go identifiers).
-->

	<script>
	document.ANALYSIS_DATA = null;
	document.CALLGRAPH = null;
	</script>

	
		
		<div id="short-nav">
			<dl>
			<dd><code>import "github.com/linchao/zkp_auth/internal/server"</code></dd>
			</dl>
			<dl>
			<dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
			<dd><a href="#pkg-index" class="indexLink">Index</a></dd>
			
			
			</dl>
		</div>
		<!-- The package's Name is printed as title by the top-level template -->
		<div id="pkg-overview" class="toggleVisible">
			<div class="collapsed">
				<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
			</div>
			<div class="expanded">
				<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
				
				
			</div>
		</div>

		<div id="pkg-index" class="toggleVisible">
		<div class="collapsed">
			<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
		</div>
		<div class="expanded">
			<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>

		<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
			<div id="manual-nav">
			<dl>
			
			
			
				
				<dd><a href="#NewGRPCSever">func NewGRPCSever(config *Config) (*grpc.Server, error)</a></dd>
			
				
				<dd><a href="#RunServer">func RunServer(config *Config)</a></dd>
			
			
				
				<dd><a href="#AuthParams">type AuthParams</a></dd>
				
				
			
				
				<dd><a href="#CPZKP">type CPZKP</a></dd>
				
				
			
				
				<dd><a href="#Config">type Config</a></dd>
				
				
			
				
				<dd><a href="#RegParams">type RegParams</a></dd>
				
				
			
				
				<dd><a href="#grpcServer">type grpcServer</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#newgrpcServer">func newgrpcServer(config *Config) (*grpcServer, error)</a></dd>
				
				
					
					<dd>&nbsp; &nbsp; <a href="#grpcServer.CreateAuthenticationChallenge">func (s *grpcServer) CreateAuthenticationChallenge(ctx context.Context, req *api.AuthenticationChallengeRequest) (*api.AuthenticationChallengeResponse, error)</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#grpcServer.Register">func (s *grpcServer) Register(ctx context.Context, req *api.RegisterRequest) (*api.RegisterResponse, error)</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#grpcServer.VerifyAuthentication">func (s *grpcServer) VerifyAuthentication(ctx context.Context, req *api.AuthenticationAnswerRequest) (*api.AuthenticationAnswerResponse, error)</a></dd>
				
			
			
			</dl>
			</div><!-- #manual-nav -->

		

		
			<h3>Package files</h3>
			<p>
			<span style="font-size:90%">
			
				<a href="/src/github.com/linchao/zkp_auth/internal/server/server.go">server.go</a>
			
			</span>
			</p>
		
		</div><!-- .expanded -->
		</div><!-- #pkg-index -->

		

		
		
		
			
			
			<h2 id="NewGRPCSever">func <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=2128:2183#L87">NewGRPCSever</a>
				<a class="permalink" href="#NewGRPCSever">&#xb6;</a>
				
				
			</h2>
			<pre>func NewGRPCSever(config *<a href="#Config">Config</a>) (*<a href="/pkg/google.golang.org/grpc/">grpc</a>.<a href="/pkg/google.golang.org/grpc/#Server">Server</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
			<p>NewGRPCServer: creates a grpc server and registers the service to that server

			
			

		
			
			
			<h2 id="RunServer">func <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=1037:1067#L46">RunServer</a>
				<a class="permalink" href="#RunServer">&#xb6;</a>
				
				
			</h2>
			<pre>func RunServer(config *<a href="#Config">Config</a>)</pre>
			
			
			

		
		
			
			
			<h2 id="AuthParams">type <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=527:611#L23">AuthParams</a>
				<a class="permalink" href="#AuthParams">&#xb6;</a>
				
				
			</h2>
			
			<pre>type AuthParams struct {
<span id="AuthParams.user"></span>    user <a href="/pkg/builtin/#string">string</a>
<span id="AuthParams.c"></span>    c    *<a href="/pkg/math/big/">big</a>.<a href="/pkg/math/big/#Int">Int</a>
<span id="AuthParams.r1"></span>    r1   *<a href="/pkg/math/big/">big</a>.<a href="/pkg/math/big/#Int">Int</a>
<span id="AuthParams.r2"></span>    r2   *<a href="/pkg/math/big/">big</a>.<a href="/pkg/math/big/#Int">Int</a>
}
</pre>

			

			

			
			
			

			

			
		
			
			
			<h2 id="CPZKP">type <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=363:435#L10">CPZKP</a>
				<a class="permalink" href="#CPZKP">&#xb6;</a>
				
				
			</h2>
			
			<pre>type CPZKP interface {
    InitCPZKPParams() (*<a href="/pkg/github.com/linchao/zkp_auth/internal/cpzkp/">cp_zkp</a>.<a href="/pkg/github.com/linchao/zkp_auth/internal/cpzkp/#CPZKPParams">CPZKPParams</a>, <a href="/pkg/builtin/#error">error</a>)
}</pre>

			

			

			
			
			

			

			
		
			
			
			<h2 id="Config">type <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=437:472#L14">Config</a>
				<a class="permalink" href="#Config">&#xb6;</a>
				
				
			</h2>
			
			<pre>type Config struct {
<span id="Config.CPZKP"></span>    CPZKP <a href="#CPZKP">CPZKP</a>
}
</pre>

			

			

			
			
			

			

			
		
			
			
			<h2 id="RegParams">type <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=474:525#L18">RegParams</a>
				<a class="permalink" href="#RegParams">&#xb6;</a>
				
				
			</h2>
			
			<pre>type RegParams struct {
<span id="RegParams.y1"></span>    y1 *<a href="/pkg/math/big/">big</a>.<a href="/pkg/math/big/#Int">Int</a>
<span id="RegParams.y2"></span>    y2 *<a href="/pkg/math/big/">big</a>.<a href="/pkg/math/big/#Int">Int</a>
}
</pre>

			

			

			
			
			

			

			
		
			
			
			<h2 id="grpcServer">type <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=613:1035#L30">grpcServer</a>
				<a class="permalink" href="#grpcServer">&#xb6;</a>
				
				
			</h2>
			
			<pre>type grpcServer struct {
    <a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/">api</a>.<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/#UnimplementedAuthServer">UnimplementedAuthServer</a>

    <span class="comment">// Simulate a server-side user directory</span>
    <span class="comment">// store the `y1` and `y2` of the specific user</span>
    <span class="comment">// Limited by in-memory non-persistence storage</span>
<span id="grpcServer.RegDir"></span>    RegDir map[<a href="/pkg/builtin/#string">string</a>]<a href="#RegParams">RegParams</a>

    <span class="comment">// Simulate a server-side authentication directory</span>
    <span class="comment">// store the `c`, `y1` and `y2` of the specific user</span>
    <span class="comment">// Limited by in-memory non-persistence storage</span>
<span id="grpcServer.AuthDir"></span>    AuthDir map[<a href="/pkg/builtin/#string">string</a>]<a href="#AuthParams">AuthParams</a>

    *<a href="#Config">Config</a>
}
</pre>

			

			

			
			
			

			
				
				<h3 id="newgrpcServer">func <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=1782:1837#L77">newgrpcServer</a>
					<a class="permalink" href="#newgrpcServer">&#xb6;</a>
					
					
				</h3>
				<pre>func newgrpcServer(config *<a href="#Config">Config</a>) (*grpcServer, <a href="/pkg/builtin/#error">error</a>)</pre>
				
				
				
			

			
				
				<h3 id="grpcServer.CreateAuthenticationChallenge">func (*grpcServer) <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=3084:3244#L127">CreateAuthenticationChallenge</a>
					<a class="permalink" href="#grpcServer.CreateAuthenticationChallenge">&#xb6;</a>
					
					
				</h3>
				<pre>func (s *grpcServer) CreateAuthenticationChallenge(ctx <a href="/pkg/context/">context</a>.<a href="/pkg/context/#Context">Context</a>, req *<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/">api</a>.<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/#AuthenticationChallengeRequest">AuthenticationChallengeRequest</a>) (
    *<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/">api</a>.<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/#AuthenticationChallengeResponse">AuthenticationChallengeResponse</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
				
				
				
				
			
				
				<h3 id="grpcServer.Register">func (*grpcServer) <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=2486:2595#L99">Register</a>
					<a class="permalink" href="#grpcServer.Register">&#xb6;</a>
					
					
				</h3>
				<pre>func (s *grpcServer) Register(ctx <a href="/pkg/context/">context</a>.<a href="/pkg/context/#Context">Context</a>, req *<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/">api</a>.<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/#RegisterRequest">RegisterRequest</a>) (
    *<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/">api</a>.<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/#RegisterResponse">RegisterResponse</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
				<p>Register: Simply registers a new grpc client (prover) on the server side
by storing the passed-in req body containing `y1` and `y2` values

				
				
				
			
				
				<h3 id="grpcServer.VerifyAuthentication">func (*grpcServer) <a href="/src/github.com/linchao/zkp_auth/internal/server/server.go?s=4442:4587#L180">VerifyAuthentication</a>
					<a class="permalink" href="#grpcServer.VerifyAuthentication">&#xb6;</a>
					
					
				</h3>
				<pre>func (s *grpcServer) VerifyAuthentication(ctx <a href="/pkg/context/">context</a>.<a href="/pkg/context/#Context">Context</a>, req *<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/">api</a>.<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/#AuthenticationAnswerRequest">AuthenticationAnswerRequest</a>) (
    *<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/">api</a>.<a href="/pkg/github.com/linchao/zkp_auth/api/v2/proto/#AuthenticationAnswerResponse">AuthenticationAnswerResponse</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
				
				
				
				
			
		
	

	







<div id="footer">
Build version go1.20.4.<br>
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
the content of this page is licensed under the
Creative Commons Attribution 3.0 License,
and code is licensed under a <a href="/LICENSE">BSD license</a>.<br>
<a href="https://golang.org/doc/tos.html">Terms of Service</a> |
<a href="https://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
</div>

</div><!-- .container -->
</div><!-- #page -->
</body>
</html>
